import { defineConfig } from "@tarojs/cli";

const path = require("path");
import devConfig from "./dev";
import prodConfig from "./prod";
import { baseConfig } from "./common";
// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数
export default defineConfig(async (merge, { command, mode }) => {
  const userConfig = {
    alias: {
      "@": path.resolve(__dirname, "..", "src"),
    },
    copy: {
      patterns: [
        { from: "src/custom-tab-bar/", to: "dist/custom-tab-bar/" } // 指定需要 copy 的目录
      ]
    }
  };
  if (process.env.NODE_ENV === "development") {
    // 本地开发构建配置（不混淆压缩）
    return merge({}, baseConfig, userConfig, devConfig);
  }
  // 生产构建配置（默认开启压缩混淆等）
  return merge({}, baseConfig, userConfig, prodConfig);
});
